From 3d05407025ed1f83f492f81ba8175fa26b1e2fb3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roger=20Pau=20Monn=C3=A9?= Date: Fri, 20 Dec 2019 16:28:27 +0100 Subject: [PATCH] x86/smp: check APIC ID on AP bringup MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Check that the processor to be woken up APIC ID is addressable in the current APIC mode. Note that in practice systems with APIC IDs > 255 should already have x2APIC enabled by the firmware, and hence this is mostly a safety belt. Signed-off-by: Roger Pau Monné Reviewed-by: Jan Beulich --- xen/arch/x86/smpboot.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c index fa691b6ba0..e439845802 100644 --- a/xen/arch/x86/smpboot.c +++ b/xen/arch/x86/smpboot.c @@ -1317,6 +1317,14 @@ int __cpu_up(unsigned int cpu) if ( (apicid = x86_cpu_to_apicid[cpu]) == BAD_APICID ) return -ENODEV; + if ( (!x2apic_enabled && apicid >= APIC_ALL_CPUS) || + (!iommu_intremap && (apicid >> 8)) ) + { + printk("Unsupported: APIC ID %#x in xAPIC mode w/o interrupt remapping\n", + apicid); + return -EINVAL; + } + if ( (ret = do_boot_cpu(apicid, cpu)) != 0 ) return ret; -- 2.30.2